Skip to content

GLOWS - fix empty issue#3180

Closed
laspsandoval wants to merge 1 commit into
IMAP-Science-Operations-Center:devfrom
laspsandoval:glows_empty
Closed

GLOWS - fix empty issue#3180
laspsandoval wants to merge 1 commit into
IMAP-Science-Operations-Center:devfrom
laspsandoval:glows_empty

Conversation

@laspsandoval
Copy link
Copy Markdown
Contributor

This pull request improves the robustness of the generate_histogram_dataset function by filtering out invalid histogram data and adds a corresponding unit test to ensure this behavior. The main focus is on ignoring histograms with zero recorded events, which prevents them from affecting downstream data processing.

Data filtering improvements:

  • Updated generate_histogram_dataset in glows_l1a.py to filter out HistogramL1A objects where number_of_events == 0, and added a warning log when such histograms are excluded.

Testing enhancements:

  • Added a new test test_generate_histogram_dataset_filters_zero_events in test_glows_l1a_cdf.py to verify that histograms with zero events are filtered out and do not appear in the resulting dataset.

@laspsandoval laspsandoval self-assigned this May 11, 2026
@laspsandoval laspsandoval added the Ins: GLOWS Related to the GLOWS instrument label May 11, 2026
@laspsandoval laspsandoval added this to the May 2026 milestone May 11, 2026
@laspsandoval laspsandoval linked an issue May 11, 2026 that may be closed by this pull request
1 task
@laspsandoval laspsandoval marked this pull request as draft May 11, 2026 21:23
Copy link
Copy Markdown
Contributor

@tech3371 tech3371 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This update looks good besides one minor comment

hist_l1a_list = valid_hists

# Filter out histograms with no recorded events (all-zero histogram data).
valid_hists = [hist for hist in hist_l1a_list if hist.number_of_events > 0]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did same in the past for GLOWS and feel like it didn't catch all cases of invalid histogram. I hope checking hist.number_of_events > 0 is enough to filter out valid histogram. @maxinelasp may be better help here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves GLOWS L1A histogram CDF generation robustness by excluding histogram records that are effectively “empty” due to having zero recorded events, and adds a unit test to validate the filtering behavior.

Changes:

  • Added filtering in generate_histogram_dataset to drop histograms where number_of_events == 0 and emit a warning when exclusions occur.
  • Added a unit test to ensure mixed histogram inputs do not include zero-event records in the output dataset.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
imap_processing/glows/l1a/glows_l1a.py Adds an additional validity filter for L1A histogram inputs (number_of_events > 0) with warning logging.
imap_processing/tests/glows/test_glows_l1a_cdf.py Adds a unit test covering filtering behavior for mixed valid and zero-event histogram inputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

f"histogram(s) with number_of_events == 0."
)
hist_l1a_list = valid_hists


assert len(dataset["epoch"].values) == 2


@github-project-automation github-project-automation Bot moved this to Done in IMAP May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ins: GLOWS Related to the GLOWS instrument

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ENH - Filter GLOWS L1A Histogram data points which are empty.

3 participants